using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_itemOnhandFdetMap : EntityTypeConfiguration<so_itemOnhandFdet>
    {
        public so_itemOnhandFdetMap()
        {
            // Primary Key
            this.HasKey(t => new { t.location, t.expiry, t.opening_date });

            // Properties
            this.Property(t => t.item)
                .HasMaxLength(10);

            this.Property(t => t.Description)
                .HasMaxLength(30);

            this.Property(t => t.location)
                .IsRequired()
                .HasMaxLength(3);

            // Table & Column Mappings
            this.ToTable("so_itemOnhandFdet");
            this.Property(t => t.item).HasColumnName("item");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.location).HasColumnName("location");
            this.Property(t => t.expiry).HasColumnName("expiry");
            this.Property(t => t.On_hand).HasColumnName("On_hand");
            this.Property(t => t.Opening_quantity).HasColumnName("Opening_quantity");
            this.Property(t => t.opening_date).HasColumnName("opening_date");
        }
    }
}
